// 获取链接的某个参数值
export function getUrlParms (name) {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
    var r = window.location.search.substr(1).match(reg)
    if (r != null) { return unescape(r[2]) }
    return null
}
/**
 * @description 获取url参数
 * @param {String} name 参数名，不传则返回所有参数的对象
 * @return {String Object}
 */
 export function getParams (name) {
    var search = window.location.search.substring(1)
    if (!search) {
        search = window.location.hash.split('?')[1]
    }
    if (search) {
        var obj = JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}')
        return name ? obj[name] : obj
    }
}
